#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 20009; //100005

int height[N];
ll sum;
int n,b,cnt;

bool cmp(int x,int y)
{
	return x>y;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin >> n >> b;
	for(int i=1;i<=n;i++)
	{
		cin >> height[i];
	}
	sort(height+1,height+1+n,cmp);
	for(cnt=1;cnt<=n;cnt++)
	{
		sum += height[cnt];
		if(sum >= b)
			break;
	}
	cout << cnt;
	return 0;
}
